﻿@model KL.Store.Web.Models.StockAmountsModel
@using KL.Store.Core
@{
    Layout = null;
}
<div id="EditStok">
    <table class="table table-bordered">
        <tr>
            <td style="width: 10%;">Depo:</td>
            <td style="width: 10%;">&nbsp;</td>
            <td>Toplam</td>
        </tr>
    </table>
    <table class="table table-bordered">
        <thead>
            <tr>
                <td>&nbsp;</td>
                <td>Devir</td>
                <td>Konsinye</td>
                <td>İrsaliye</td>
                <td>Fatura</td>
                <td>Stok Har.</td>
                <td>Üretim</td>
                <td>Transfer</td>
                <td>Sipariş</td>
                <td>Rezerve</td>
                <td>Stok</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="tdtitle">Giriş</td>
                <td>@(Model.Amounts.Sum(o => o.DevirGiris) != 0 ? Model.Amounts.Sum(o => o.DevirGiris).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.KonsinyeGiris) != 0 ? Model.Amounts.Sum(o => o.KonsinyeGiris).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.IrsaliyeGiris) != 0 ? Model.Amounts.Sum(o => o.IrsaliyeGiris).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.FaturaGiris) != 0 ? Model.Amounts.Sum(o => o.FaturaGiris).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.StokGiris) != 0 ? Model.Amounts.Sum(o => o.StokGiris).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.UretimGiris) != 0 ? Model.Amounts.Sum(o => o.UretimGiris).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.TransferGiris) != 0 ? Model.Amounts.Sum(o => o.TransferGiris).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.SiparisAlis) != 0 ? Model.Amounts.Sum(o => o.SiparisAlis).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.RezerveAlis) != 0 ? Model.Amounts.Sum(o => o.RezerveAlis).ToString("###,###,##0") : "")</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td class="tdtitle">Çıkış</td>
                <td>&nbsp;</td>
                <td>@(Model.Amounts.Sum(o => o.KonsinyeCikis) != 0 ? Model.Amounts.Sum(o => o.KonsinyeCikis).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.IrsaliyeCikis) != 0 ? Model.Amounts.Sum(o => o.IrsaliyeCikis).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.FaturaCikis) != 0 ? Model.Amounts.Sum(o => o.FaturaCikis).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.StokCikis) != 0 ? Model.Amounts.Sum(o => o.StokCikis).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.UretimCikis) != 0 ? Model.Amounts.Sum(o => o.UretimCikis).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.TransferCikis) != 0 ? Model.Amounts.Sum(o => o.TransferCikis).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.SiparisSatis) != 0 ? Model.Amounts.Sum(o => o.SiparisSatis).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.RezerveSatis) != 0 ? Model.Amounts.Sum(o => o.RezerveSatis).ToString("###,###,##0") : "")</td>
                <td>&nbsp;</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td class="tdtitle">Kalan</td>
                <td>@(Model.Amounts.Sum(o => o.DevirGiris) != 0 ? Model.Amounts.Sum(o => o.DevirGiris).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.KonsinyeKalan) != 0 ? Model.Amounts.Sum(o => o.KonsinyeKalan).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.IrsaliyeKalan) != 0 ? Model.Amounts.Sum(o => o.IrsaliyeKalan).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.FaturaKalan) != 0 ? Model.Amounts.Sum(o => o.FaturaKalan).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.StokKalan) != 0 ? Model.Amounts.Sum(o => o.StokKalan).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.UretimKalan) != 0 ? Model.Amounts.Sum(o => o.UretimKalan).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.TransferKalan) != 0 ? Model.Amounts.Sum(o => o.TransferKalan).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.SiparisKalan) != 0 ? Model.Amounts.Sum(o => o.SiparisKalan).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.RezerveKalan) != 0 ? Model.Amounts.Sum(o => o.RezerveKalan).ToString("###,###,##0") : "")</td>
                <td>@(Model.Amounts.Sum(o => o.StokToplam) != 0 ? Model.Amounts.Sum(o => o.StokToplam).ToString("###,###,##0") : "")</td>
            </tr>
        </tfoot>
    </table>
    <hr />
    @foreach (var stok in Model.Amounts)
    {
        <table class="table table-bordered">
            <tr>
                <td style="width: 10%;">Depo:</td>
                <td style="width: 10%;">@stok.AmbarId</td>
                <td>@stok.AmbarName</td>
            </tr>
        </table>
        <table class="table table-bordered">
            <thead>
                <tr>
                    <td>&nbsp;</td>
                    <td>Devir</td>
                    <td>Konsinye</td>
                    <td>İrsaliye</td>
                    <td>Fatura</td>
                    <td>Stok Har.</td>
                    <td>Üretim</td>
                    <td>Transfer</td>
                    <td>Sipariş</td>
                    <td>Rezerve</td>
                    <td>Stok</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td class="tdtitle">Giriş</td>
                    <td>@(stok.DevirGiris != 0 ? stok.DevirGiris.ToString("###,###,##0") : "")</td>
                    <td>@(stok.KonsinyeGiris != 0 ? stok.KonsinyeGiris.ToString("###,###,##0") : "")</td>
                    <td>@(stok.IrsaliyeGiris != 0 ? stok.IrsaliyeGiris.ToString("###,###,##0") : "")</td>
                    <td>@(stok.FaturaGiris != 0 ? stok.FaturaGiris.ToString("###,###,##0") : "")</td>
                    <td>@(stok.StokGiris != 0 ? stok.StokGiris.ToString("###,###,##0") : "")</td>
                    <td>@(stok.UretimGiris != 0 ? stok.UretimGiris.ToString("###,###,##0") : "")</td>
                    <td>@(stok.TransferGiris != 0 ? stok.TransferGiris.ToString("###,###,##0") : "")</td>
                    <td>@(stok.SiparisAlis != 0 ? stok.SiparisAlis.ToString("###,###,##0") : "")</td>
                    <td>@(stok.RezerveAlis != 0 ? stok.RezerveAlis.ToString("###,###,##0") : "")</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td class="tdtitle">Çıkış</td>
                    <td>&nbsp;</td>
                    <td>@(stok.KonsinyeCikis != 0 ? stok.KonsinyeCikis.ToString("###,###,##0") : "")</td>
                    <td>@(stok.IrsaliyeCikis != 0 ? stok.IrsaliyeCikis.ToString("###,###,##0") : "")</td>
                    <td>@(stok.FaturaCikis != 0 ? stok.FaturaCikis.ToString("###,###,##0") : "")</td>
                    <td>@(stok.StokCikis != 0 ? stok.StokCikis.ToString("###,###,##0") : "")</td>
                    <td>@(stok.UretimCikis != 0 ? stok.UretimCikis.ToString("###,###,##0") : "")</td>
                    <td>@(stok.TransferCikis != 0 ? stok.TransferCikis.ToString("###,###,##0") : "")</td>
                    <td>@(stok.SiparisSatis != 0 ? stok.SiparisSatis.ToString("###,###,##0") : "")</td>
                    <td>@(stok.RezerveSatis != 0 ? stok.RezerveSatis.ToString("###,###,##0") : "")</td>
                    <td>&nbsp;</td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td class="tdtitle">Kalan</td>
                    <td>@(stok.DevirGiris != 0 ? stok.DevirGiris.ToString("###,###,##0") : "")</td>
                    <td>@(stok.KonsinyeKalan != 0 ? stok.KonsinyeKalan.ToString("###,###,##0") : "")</td>
                    <td>@(stok.IrsaliyeKalan != 0 ? stok.IrsaliyeKalan.ToString("###,###,##0") : "")</td>
                    <td>@(stok.FaturaKalan != 0 ? stok.FaturaKalan.ToString("###,###,##0") : "")</td>
                    <td>@(stok.StokKalan != 0 ? stok.StokKalan.ToString("###,###,##0") : "")</td>
                    <td>@(stok.UretimKalan != 0 ? stok.UretimKalan.ToString("###,###,##0") : "")</td>
                    <td>@(stok.TransferKalan != 0 ? stok.TransferKalan.ToString("###,###,##0") : "")</td>
                    <td>@(stok.SiparisKalan != 0 ? stok.SiparisKalan.ToString("###,###,##0") : "")</td>
                    <td>@(stok.RezerveKalan != 0 ? stok.RezerveKalan.ToString("###,###,##0") : "")</td>
                    <td>@(stok.StokToplam != 0 ? stok.StokToplam.ToString("###,###,##0") : "")</td>
                </tr>
            </tfoot>
        </table>
        <hr />
    }
    <div class="alignright">
        <button type="button" class="btn btn-custom1" onclick="KapatVeYenile();">Kapat ve Yenile</button>
    </div>
</div>
